//
//  InvestRecordCell.m
//  Kjs-iOS
//
//  Created by cfq on 16/6/3.
//  Copyright © 2016年 jmhz. All rights reserved.
//

#import "InvestRecordCell.h"

@interface InvestRecordCell ()


@property (nonatomic,weak) IBOutlet UILabel *nickNameLab;
@property (nonatomic,weak) IBOutlet UILabel *amoutLab;
@property (nonatomic,weak) IBOutlet UILabel *DateLab;

@end

@implementation InvestRecordCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.nickNameLab.adjustsFontSizeToFitWidth = YES;
    self.amoutLab.adjustsFontSizeToFitWidth = YES;
    self.DateLab.adjustsFontSizeToFitWidth = YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setInvestUser:(InvestUser *)investUser
{
    self.nickNameLab.text = [NSString stringWithFormat:@"%@",investUser.nickName];
    NSDateFormatter *df = [[NSDateFormatter alloc] init];
    [df setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    [df setLocale:[[NSLocale alloc]initWithLocaleIdentifier:@"zh_CN"]];
    NSDate *createdDate = [NSDate dateWithTimeIntervalSince1970:(investUser.createdStamp + 8 * 3600 * 1000)/1000];
    NSArray *strArray = [[NSString stringWithFormat:@"%@",createdDate] componentsSeparatedByString:@"+"];
    self.DateLab.text = [strArray count]>0?strArray[0]:nil;
    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    formatter.numberStyle = NSNumberFormatterDecimalStyle;
    NSString *totalInvestment = [formatter stringFromNumber:[NSNumber numberWithDouble:investUser.totalInvestment]];
    self.amoutLab.text = [NSString stringWithFormat:@"¥%@",totalInvestment];

}

@end
